/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Shell;

import StaticClass.ArrSocket;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Oho
 */
public class ExecuteShell extends Thread{
    Socket sk;
 //   ServerSocket server;
    public ExecuteShell(Socket soc) throws IOException{
        this.sk=soc;
        
        //sk.close();
    }
    public void WriteExecute(String command){
        try {
            BufferedWriter bw = null;
            bw = new BufferedWriter(new OutputStreamWriter(sk.getOutputStream()));
//            String lenh = null;


                //System.out.println("Nhap lenh (shutdown,restart,log off): ");

                bw.write(command);
                bw.newLine();
                bw.flush();
        } catch (IOException ex) {
            Logger.getLogger(ExecuteShell.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    @Override
    public void run(){
        ArrSocket.ArrShell.add(this);
        
    }
}
